gdk: Fix gdk_surface_get_layout_monitor
authorMatthias Clasen <mclasen@redhat.com>
Mon, 3 Aug 2020 01:27:03 +0000 (21:27 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 3 Aug 2020 01:29:18 +0000 (21:29 -0400)
We are determining the monitor by maximizing the
intersection; that only works if our rectangle
is not empty.

Fixes: #3003
gdk/gdksurface.c

index 63abe2595bb051ce839111f4692adc2040843cc9..6d8b84ee34e2e832d3bc1424706c444f52266d3d 100644 (file)
@@ -265,6 +265,9 @@ gdk_surface_get_layout_monitor (GdkSurface      *surface,
                                &root_rect.x,
                                &root_rect.y);
 
+  root_rect.width = MAX (1, root_rect.width);
+  root_rect.height = MAX (1, root_rect.height);
+
   display = get_display_for_surface (surface, surface->transient_for);
   return get_monitor_for_rect (display, &root_rect, get_bounds);
 }